
load_fdf [[
    
    //背景模板
    Frame "BACKDROP" "panel" {
        BackdropBackground  "core\Transparent.tga",
    }

    //模型
    Frame "SPRITE" "model" {
        BackgroundArt "UI\Glues\BattleNet\BattlenetWorking\BattlenetWorking.mdl",
        //LayerStyle "3DWINDOW|NOSHADING|NODEPTHSET|NODEPTHTEST",
        LayerStyle "IGNORETRACKEVENTS",
        SetAllPoints,
    }

    Frame "CHECKBOX" "Checked" {
        Width 0.024,
        Height 0.024,
    
        // 常规贴图
        ControlBackdrop "StandardCheckBoxBackdrop",
        Frame "BACKDROP" "StandardCheckBoxBackdrop" {
            BackdropBlendAll,
            BackdropBackground  "UI\Widgets\Glues\GlueScreen-Checkbox-Background.blp",
        }
    
        Checked,
    
        // 点击贴图
        ControlPushedBackdrop "StandardCheckBoxPushedBackdrop",
        Frame "BACKDROP" "StandardCheckBoxPushedBackdrop" {
            BackdropBlendAll,
            BackdropBackground  "UI\Widgets\Glues\GlueScreen-Checkbox-BackgroundPressed.blp",
        }
    
        // 禁用贴图
        ControlDisabledBackdrop "StandardCheckBoxDisabledBackdrop",
        Frame "BACKDROP" "StandardCheckBoxDisabledBackdrop" {
            BackdropBlendAll,
            BackdropBackground  "UI\Widgets\Glues\GlueScreen-Checkbox-BackgroundDisabled.blp",
        }
    
        // 对号
        CheckBoxCheckHighlight "StandardCheckHighlightTemplate",
        Frame "HIGHLIGHT" "StandardCheckHighlightTemplate" {
            HighlightType "FILETEXTURE",
            HighlightAlphaFile "UI\Widgets\Glues\GlueScreen-Checkbox-Check.blp",    
            HighlightAlphaMode "BLEND",
        }
    
        // 对号 灰色状态
         CheckBoxDisabledCheckHighlight "StandardDisabledCheckHighlightTemplate",
         Frame "HIGHLIGHT" "StandardDisabledCheckHighlightTemplate" {
             HighlightType "FILETEXTURE",
             HighlightAlphaFile "UI\Widgets\Glues\GlueScreen-Checkbox-CheckDisabled.blp",    
             HighlightAlphaMode "BLEND",
         }
    }
    

    Frame "CHECKBOX" "Check" {
        Width 0.024,
        Height 0.024,
    
        // 常规贴图
        ControlBackdrop "StandardCheckBoxBackdrop",
        Frame "BACKDROP" "StandardCheckBoxBackdrop" {
            BackdropBlendAll,
            BackdropBackground  "UI\Widgets\Glues\GlueScreen-Checkbox-Background.blp",
        }
    
        // 点击贴图
        ControlPushedBackdrop "StandardCheckBoxPushedBackdrop",
        Frame "BACKDROP" "StandardCheckBoxPushedBackdrop" {
            BackdropBlendAll,
            BackdropBackground  "UI\Widgets\Glues\GlueScreen-Checkbox-BackgroundPressed.blp",
        }
    
        // 禁用贴图
        ControlDisabledBackdrop "StandardCheckBoxDisabledBackdrop",
        Frame "BACKDROP" "StandardCheckBoxDisabledBackdrop" {
            BackdropBlendAll,
            BackdropBackground  "UI\Widgets\Glues\GlueScreen-Checkbox-BackgroundDisabled.blp",
        }
    
        // 对号
        CheckBoxCheckHighlight "StandardCheckHighlightTemplate",
        Frame "HIGHLIGHT" "StandardCheckHighlightTemplate" {
            HighlightType "FILETEXTURE",
            HighlightAlphaFile "UI\Widgets\Glues\GlueScreen-Checkbox-Check.blp",    
            HighlightAlphaMode "BLEND",
        }
    
        // 对号 灰色状态
         CheckBoxDisabledCheckHighlight "StandardDisabledCheckHighlightTemplate",
         Frame "HIGHLIGHT" "StandardDisabledCheckHighlightTemplate" {
             HighlightType "FILETEXTURE",
             HighlightAlphaFile "UI\Widgets\Glues\GlueScreen-Checkbox-CheckDisabled.blp",    
             HighlightAlphaMode "BLEND",
         }
    }
    

    // 按钮
    Frame "BUTTON" "button" {
        Width 0.016,
        Height 0.016,
        //设置正常状态下背景
        ControlBackdrop "buttonBackdrop",
        // 鼠标进入的模型 CursorSprite "UI\Glues\MainMenu\WarCraftIIILogo\WarCraftIIILogo.mdx",
        Frame "BACKDROP" "buttonBackdrop" {
            BackdropBackground  "core\Transparent.tga",
            BackdropBlendAll,
        }
        //设置按下状态下背景 
        ControlPushedBackdrop "buttonPusheddBackdrop",
        Frame "BACKDROP" "buttonPusheddBackdrop" {
            BackdropBackground  "core\Transparent.tga",
            BackdropBlendAll,
        }
        //设置禁用状态下背景
        ControlDisabledBackdrop "buttonDisabledBackdrop",
        Frame "BACKDROP" "buttonDisabledBackdrop" {
            BackdropBackground  "core\Transparent.tga",
            BackdropBlendAll,
        }
    }

    // 输入框
    Frame "EDITBOX" "editbox" {
        Height 0.044375,
        Width 0.0465625,
        EditBorderSize 0.008,
        EditCursorColor 1.0 1.0 1.0,    
        EditTextFrame "editboxtext",
        // EditSetFocus,        // 焦点?
        // EditTextOffset       // 偏移
        // EditMaxChars         // 字数限制
        Frame "TEXT" "editboxtext" {
            LayerStyle "IGNORETRACKEVENTS",
            FrameFont "MasterFont", 0.012, "",
        }
    }

    // 滑动条 横向模板
    Frame "SLIDER" "sliderH" {
        Height 0.012,
        Width 0.139,
        SliderMinValue 0,		//最小值
        SliderMaxValue 5,		//最大值
        SliderInitialValue 1,	//初始化值
        SliderStepSize 0.1,		//步进值 
        //SliderLayoutVertical,   //设置为垂直滚动条
        SliderLayoutHorizontal, 	//设置为水平滚动条 

        ControlBackdrop "sliderHBackdrop",
        Frame "BACKDROP" "sliderHBackdrop" {
            DecorateFileNames,
            BackdropTileBackground,
            BackdropBackground  "EscMenuSliderBackground",
            BackdropCornerFlags "UL|UR|BL|BR|T|L|B|R",
            BackdropCornerSize  0.006,
            BackdropBackgroundSize 0.006,
            BackdropBackgroundInsets 0.0025 0.0025 0.0025 0.0025,
            BackdropEdgeFile  "EscMenuSliderBorder",
            BackdropBlendAll,
        }

        ControlDisabledBackdrop "sliderHDisabledBackdrop",
        Frame "BACKDROP" "sliderHDisabledBackdrop" {
            DecorateFileNames,
            BackdropTileBackground,
            BackdropBackground  "EscMenuSliderBackground",
            BackdropCornerFlags "UL|UR|BL|BR|T|L|B|R",
            BackdropCornerSize  0.006,
            BackdropBackgroundSize 0.006,
            BackdropBackgroundInsets 0.0025 0.0025 0.0025 0.0025,
            BackdropEdgeFile  "EscMenuSliderDisabledBorder",
            BackdropBlendAll,
        }

        SliderThumbButtonFrame "sliderHThumbButton",
        Frame "BUTTON" "sliderHThumbButton" {
            Width 0.016,
            Height 0.016,

            ControlBackdrop "sliderHThumbButtonBackdrop",
            Frame "BACKDROP" "sliderHThumbButtonBackdrop" {
                DecorateFileNames,
                BackdropBlendAll,
                BackdropBackground  "EscMenuSliderThumbButton",
            }

            ControlDisabledBackdrop "sliderHThumbButtonDisabledBackdrop",
            Frame "BACKDROP" "sliderHThumbButtonDisabledBackdrop" {
                DecorateFileNames,
                BackdropBlendAll,
                BackdropBackground  "EscMenuSliderDisabledThumbButton",
            }

        }
    }

    // 滑动条 竖向模板
    Frame "SLIDER" "sliderV" {
        Width 0.012,
        Height 0.139,
        SliderMinValue 0,		//最小值
        SliderMaxValue 5,		//最大值
        SliderInitialValue 1,	//初始化值
        SliderStepSize 0.1,		//步进值 
        SliderLayoutVertical,   //设置为垂直滚动条

        ControlBackdrop "sliderVBackdrop",
        Frame "BACKDROP" "sliderVBackdrop" {
            DecorateFileNames,
            BackdropTileBackground,
            BackdropBackground  "EscMenuSliderBackground",
            BackdropCornerFlags "UL|UR|BL|BR|T|L|B|R",
            BackdropCornerSize  0.006,
            BackdropBackgroundSize 0.006,
            BackdropBackgroundInsets 0.0025 0.0025 0.0025 0.0025,
            BackdropEdgeFile  "EscMenuSliderBorder",
            BackdropBlendAll,
        }

        ControlDisabledBackdrop "sliderVDisabledBackdrop",
        Frame "BACKDROP" "sliderVDisabledBackdrop" {
            DecorateFileNames,
            BackdropTileBackground,
            BackdropBackground  "EscMenuSliderBackground",
            BackdropCornerFlags "UL|UR|BL|BR|T|L|B|R",
            BackdropCornerSize  0.006,
            BackdropBackgroundSize 0.006,
            BackdropBackgroundInsets 0.0025 0.0025 0.0025 0.0025,
            BackdropEdgeFile  "EscMenuSliderDisabledBorder",
            BackdropBlendAll,
        }

        SliderThumbButtonFrame "sliderVThumbButton",
        Frame "BUTTON" "sliderVThumbButton" {

            ControlBackdrop "sliderVThumbButtonBackdrop",
            Frame "BACKDROP" "sliderVThumbButtonBackdrop" {
                DecorateFileNames,
                BackdropBlendAll,
                BackdropBackground  "EscMenuSliderThumbButton",
            }

            ControlDisabledBackdrop "sliderVThumbButtonDisabledBackdrop",
            Frame "BACKDROP" "sliderVThumbButtonDisabledBackdrop" {
                DecorateFileNames,
                BackdropBlendAll,
                BackdropBackground  "EscMenuSliderDisabledThumbButton",
            }
        }
    }

    Frame "BACKDROP" "EscMenuButtonBackdropTemplate" {
        DecorateFileNames,
        BackdropTileBackground,
        BackdropBackground  "EscMenuButtonBackground",
        BackdropCornerFlags "UL|UR|BL|BR|T|L|B|R",
        BackdropCornerSize  0.0125,
        BackdropBackgroundSize  0.256,
        BackdropBackgroundInsets 0.005 0.005 0.005 0.005,
        BackdropEdgeFile  "EscMenuButtonBorder",
    }

    Frame "BACKDROP" "EscMenuButtonPushedBackdropTemplate" {
        DecorateFileNames,
        BackdropTileBackground,
        BackdropBackground  "EscMenuButtonPushedBackground",
        BackdropCornerFlags "UL|UR|BL|BR|T|L|B|R",
        BackdropCornerSize  0.0125,
        BackdropBackgroundSize  0.256,
        BackdropBackgroundInsets 0.005 0.005 0.005 0.005,
        BackdropEdgeFile  "EscMenuButtonPushedBorder",
    }

    Frame "BACKDROP" "EscMenuButtonDisabledBackdropTemplate" {
        DecorateFileNames,
        BackdropTileBackground,
        BackdropBackground  "EscMenuButtonDisabledBackground",
        BackdropCornerFlags "UL|UR|BL|BR|T|L|B|R",
        BackdropCornerSize  0.0125,
        BackdropBackgroundSize  0.256,
        BackdropBackgroundInsets 0.005 0.005 0.005 0.005,
        BackdropEdgeFile  "EscMenuButtonDisabledBorder",
    }

    Frame "BACKDROP" "EscMenuButtonDisabledPushedBackdropTemplate" {
        DecorateFileNames,
        BackdropTileBackground,
        BackdropBackground  "EscMenuButtonDisabledPushedBackground",
        BackdropCornerFlags "UL|UR|BL|BR|T|L|B|R",
        BackdropCornerSize  0.0125,
        BackdropBackgroundSize  0.256,
        BackdropBackgroundInsets 0.005 0.005 0.005 0.005,
        BackdropEdgeFile  "EscMenuButtonDisabledPushedBorder",
    }

    Frame "BACKDROP" "EscMenuControlBackdropTemplate" {
        DecorateFileNames,
        BackdropTileBackground,
        BackdropBackground  "EscMenuEditBoxBackground",
        BackdropCornerFlags "UL|UR|BL|BR|T|L|B|R",
        BackdropCornerSize  0.0125,
        BackdropBackgroundSize  0.256,
        BackdropBackgroundInsets 0.005 0.005 0.005 0.005,
        BackdropEdgeFile  "EscMenuEditBoxBorder",
        BackdropBlendAll,
    }

    Frame "HIGHLIGHT" "EscMenuButtonMouseOverHighlightTemplate" {
        DecorateFileNames,
        HighlightType "FILETEXTURE",
        HighlightAlphaFile "EscMenuButtonMouseOverHighlight",
        HighlightAlphaMode "ADD",
    }

    Frame "GLUETEXTBUTTON" "EscMenuButtonTemplate" {
        Width 0.228,
        Height 0.035,
        ControlStyle "AUTOTRACK|HIGHLIGHTONMOUSEOVER",
        ButtonPushedTextOffset 0.002f -0.002f,    

        ControlBackdrop "ButtonBackdropTemplate",
        Frame "BACKDROP" "ButtonBackdropTemplate" INHERITS "EscMenuButtonBackdropTemplate" {
        }

        ControlPushedBackdrop "ButtonPushedBackdropTemplate",
        Frame "BACKDROP" "ButtonPushedBackdropTemplate" INHERITS "EscMenuButtonPushedBackdropTemplate" {
        }

        ControlDisabledBackdrop "ButtonDisabledBackdropTemplate",
        Frame "BACKDROP" "ButtonDisabledBackdropTemplate" INHERITS "EscMenuButtonDisabledBackdropTemplate" {
        }

        ControlDisabledPushedBackdrop "ButtonDisabledPushedBackdropTemplate",
        Frame "BACKDROP" "ButtonDisabledPushedBackdropTemplate" INHERITS "EscMenuButtonDisabledPushedBackdropTemplate" {
        }

        ControlMouseOverHighlight "ButtonMouseOverHighlightTemplate",
        Frame "HIGHLIGHT" "ButtonMouseOverHighlightTemplate" INHERITS "EscMenuButtonMouseOverHighlightTemplate" {
        }
    }

    Frame "BACKDROP" "tooltip" {

        BackdropBackground  "UI\Widgets\ToolTips\Human\human-tooltip-background.blp",
        BackdropCornerFlags "UL|UR|BL|BR|T|L|B|R", // Flags
        BackdropCornerSize  0.006, //边界大小
        BackdropBackgroundInsets 0.0012 0.0012 0.0012 0.0012,
        BackdropEdgeFile  "UI\Widgets\ToolTips\Human\human-tooltip-border.blp",
        BackdropBlendAll, //Blend，开启透明通道
        

        // BackdropBackground  "UI\Widgets\ToolTips\Human\human-tooltip-background.blp",
        // BackdropCornerFlags "UL|UR|BL|BR|T|L|B|R",
        // BackdropCornerSize  0.01f,
        // BackdropBackgroundInsets 0.003f 0.003f 0.003f 0.003f,
        // BackdropEdgeFile  "UI\Widgets\ToolTips\Human\human-tooltip-border.blp",

        // UseActiveContext,
        // BackdropTileBackground,
        // BackdropBackground  "textures\black32.blp",
        // BackdropCornerFlags "UL|UR|BL|BR|T|L|B|R",
        // BackdropCornerSize  0.01f,
        // BackdropBackgroundInsets 0.003f 0.003f 0.003f 0.003f,
        // BackdropEdgeFile  "UI\tooltip-border.blp",
    }


    
    Frame "BACKDROP" "黑色背景框" {
        UseActiveContext,
        BackdropTileBackground,
        BackdropBackground  "UI\Widgets\BattleNet\bnet-dialoguebox-background.blp",
        BackdropCornerFlags "UL|UR|BL|BR|T|L|B|R",
        BackdropCornerSize  0.03f,
        BackdropBackgroundInsets 0.004f 0.004f 0.004f 0.004f,
        BackdropEdgeFile  "UI\Widgets\BattleNet\bnet-dialoguebox-border.blp",
    }
]]



local storm = require 'jass.storm'
local str = [[4d444c585645525304{6}2003{4}4d4f444c7401{4}4a75737420416e6f74686572204d6f64656c{644}4d79643dafdd0bbdc89a2cbd{8}b8c4193dec61023d{8}96{6}5345515384{6}5374616e64{150}4d01{4}3505{36}4d79643dafdd0bbdc89a2cbd{8}b8c4193dec61023d{8}4d544c533{7}3{7}e703{5}1{6}4c41595301{6}1c{14}71{14}ffffffff{12}803f544558530c01{12}54657874757265735c426c61636b33322e626c7{489}47454f533c01{4}3c01{4}5652545804{6}9a9999b1cdccccb{5}fac3aca32a3d{12}fac3ada32a3d6488633d{4}fac310281bb06488633d{4}fac34e524d5304{26}803f{20}803f{20}803f{20}803f5054595001{7}4{6}50434e5401{7}6{6}5056545806{7}3{7}100030001000200474e445804{14}4d54474301{7}1{6}4d41545301{38}76348e3d9a9999b1cdccccb{5}fac3ada32a3d6488633d{4}fac301{6}76348e3d9a9999b1cdccccb{5}fac3ada32a3d6488633d{4}fac35556415301{6}5556425304{18}803f{12}803f{12}803f{12}803f424f4e4568{6}6{7}44656661756c7420426f6e65{144}ffffffff0001{12}ffffffff504956540c{30}]]

str = str:gsub('%{(%d+)%}', function (len) return string.rep('0', len) end)
local s = {}
for i = 1, #str, 2 do 
local byte = string.format("%d", '0x' .. str:sub(i, i + 1))
s[#s + 1] = string.char(byte)
end 
storm.save("ui\\_model_backdrop.mdx", table.concat(s))
